<template>
  <template v-if="modelValue.group === 'layout'">
    <template v-for="(item, index) in modelValue.formItemList">
      <FormItemNestedRender v-model="modelValue.formItemList[index]" :data="data" />
    </template>
  </template>
  <template v-else>
    <FormItem class="custom-item" :field="modelValue" :key="modelValue.id" :data="data" />
  </template>
</template>

<script setup lang="ts">
import { FormField } from '@/components/DesignForm';

defineOptions({ name: 'FormItemNestedRender' });

const modelValue = defineModel<FormField>();

const data = defineModel<Record<string, any>>('data');

</script>

<style lang="scss" scoped></style>
